package com.palominocia.capa_datos_nodo.util;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.StringUtils;

public class Base64Example {

	public static String decode(String str) {
		return StringUtils.newStringUtf8(Base64.decodeBase64(str));
	}

	public static String encode(String str) {
		return Base64.encodeBase64String(StringUtils.getBytesUtf8(str));
	}

	public static void main(String[] args) {

		String name = "Madan Chaudhary";

		System.out.println("Name : " + name);

		String encodedName = encode(name);

		System.out.println("encodedName : " + encodedName);

		String decodedName = decode(encodedName);

		System.out.println("decodedName : " + decodedName);

	}

}